<template>
    <div>
        <div class="bg-white ">
            <BaseHead>基本信息</BaseHead>
            <div class="p-[10px]">
                <el-descriptions title="" :column="2" border label-width="140">
                    <el-descriptions-item label-class-name="gdlable" label="会议名称">{{
                    ruleForm.name
                }}</el-descriptions-item>
                    <el-descriptions-item label-class-name="gdlable" label="会议主题">{{
                        ruleForm.meetingTheme
                    }}</el-descriptions-item>
                    <el-descriptions-item label-class-name="gdlable" label="会议类型">
                        <Feedback :id="ruleForm.meetingTypeId" :list="hylxList">
                        </Feedback>
                    </el-descriptions-item>
                    <el-descriptions-item label-class-name="gdlable" label="主办单位">{{
                    ruleForm.operateUnit
                }}</el-descriptions-item>
                    <el-descriptions-item label-class-name="gdlable" label="会议位置">{{
                        ruleForm.meetingScope == '1' ? '国内' : '国外'
                    }}</el-descriptions-item>
                    <el-descriptions-item label-class-name="gdlable" label="协办单位">{{
                        ruleForm.assistanceUnit
                    }}</el-descriptions-item>
                    <el-descriptions-item label-class-name="gdlable" label="会议地点">{{
                        ruleForm.meetingPlace
                    }}</el-descriptions-item>
                    <el-descriptions-item label-class-name="gdlable" label="承办部门">
                        <Feedback :id="ruleForm.unitId" :list="zcgsdwList" :mapping="['codeColumn', 'valueColumn']">
                        </Feedback>
                    </el-descriptions-item>
                    <el-descriptions-item label-class-name="gdlable" label="开始日期">{{
                    dateFormatter3(ruleForm.beginDate)
                }}</el-descriptions-item>
                    <el-descriptions-item label-class-name="gdlable" label="结束日期">{{
                        dateFormatter3(ruleForm.endDate)
                    }}</el-descriptions-item>
                    <el-descriptions-item label-class-name="gdlable" label="简介">{{
                        ruleForm.intro
                    }}</el-descriptions-item>
                    <el-descriptions-item label-class-name="gdlable" label="会议相关文档">
                        <div v-for="item in ruleForm.fileList" :key="item.id">{{ item.fileName
                            }}<el-link type="primary" style="margin-left: 8px;"
                                @click="downloadMet(item.id)">下载</el-link>
                        </div>
                    </el-descriptions-item>
                </el-descriptions>
            </div>
        </div>
        <!-- 详细信息 -->
        <div class="bg-white mt-[10px]">
            <BaseHead>详细信息</BaseHead>
            <div class="p-[10px]">
                <el-descriptions title="" :column="2" border label-width="140">
                    <el-descriptions-item label-class-name="gdlable" label="代表人数">{{
                    ruleForm.personNumber
                }}</el-descriptions-item>
                    <el-descriptions-item label-class-name="gdlable" label="论文数量">{{
                        ruleForm.paperNumber
                    }}</el-descriptions-item>
                    <el-descriptions-item label-class-name="gdlable" label="国外代表数量">{{
                        ruleForm.foreignDeputyNumber
                    }}</el-descriptions-item>
                    <el-descriptions-item label-class-name="gdlable" label="会议联系人">{{
                        ruleForm.meetingContacts
                    }}</el-descriptions-item>
                    <el-descriptions-item label-class-name="gdlable" label="会议电话">{{
                        ruleForm.meetingTel
                    }}</el-descriptions-item>
                    <el-descriptions-item label-class-name="gdlable" label="会议邮箱">{{
                        ruleForm.meetingEmail
                    }}</el-descriptions-item>
                    <el-descriptions-item label-class-name="gdlable" label="是否形成综合报告或建议">{{
                        ruleForm.isFormReport == '1' ? '是' : '否'
                    }}</el-descriptions-item>
                    <el-descriptions-item label-class-name="gdlable" label="会议经费">{{
                        ruleForm.feeTotal
                    }}</el-descriptions-item>
                    <el-descriptions-item label-class-name="gdlable" label="经费来源">{{
                        ruleForm.feeSource
                        }}</el-descriptions-item>
                </el-descriptions>
            </div>
        </div>
    </div>
</template>
<script setup>
import BaseHead from "@/views/project/components/BaseHead.vue";
import useCategoryStore from "@/store/modules/category";
const props = defineProps({
    id: String,
})

const categoryStore = useCategoryStore();
const { hylxList, zcgsdwList } = storeToRefs(categoryStore); // 解构状态
const { gethylxList, getzcgsdwList } = categoryStore; // 解构方法

const ruleForm = reactive({
    name: '',
    meetingTheme: '',
    meetingTypeId: '',
    operateUnit: '',
    assistanceUnit: '',
    meetingPlace: '',
    unitId: '',
    beginDate: '',
    endDate: '',
    intro: '',
    personNumber: null,
    paperNumber: null,
    foreignDeputyNumber: null,
    meetingContacts: '',
    meetingTel: '',
    meetingEmail: '',
    isFormReport: '1',
    feeTotal: '',
    feeSource: '',
    meetingScope: '',
});
const tableData = reactive([
]);

const getRuleForm = (i) => {
    if (!hylxList.value.length) {
        gethylxList()
    }
    if (!zcgsdwList.value.length) {
        getzcgsdwList()
    }
    if (i.honorAuthorVOs && i.honorAuthorVOs.length > 0) {
        tableData.length = 0; // 清空数组
        tableData.push(...i.honorAuthorVOs); // 添加新元素

    }
    for (const key in i) {
        ruleForm[key] = i[key];
    }
}
const { proxy } = getCurrentInstance();
const downloadMet = (i) => {
    proxy.$download.common(i)
}
defineExpose({
    getRuleForm
})
</script>
<style lang="scss">
.gdlable {
    width: 140px;
}
</style>
<style scoped lang="scss">
@import url("@/views/achievement/index.scss");

:deep(.el-select--default) {


    .el-select__wrapper.is-disabled {
        background-color: #fff;
        box-shadow: 0 0 0 0px var(--el-select-disabled-border) inset;
        color: #606266;
        cursor: not-allowed;

        .el-select__selected-item {
            color: #606266;
        }
    }

    .el-select__suffix {
        display: none;
    }
}
</style>
